<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script src="../libs/jquery.min.js"></script>
		<script src="../libs/template-web.js"></script>

		<script>

			// 为 Ajax 全局设置Token
			$.ajaxSetup({
				beforeSend: function(xhr) {
					const token = JSON.parse(localStorage.getItem('userData')).token;
					xhr.setRequestHeader('Authorization', token);
				}
			})

			//检测用户登录状态
			$.ajax(baseURL + '/login/status', {
				success: function(res) {
					// 用户已登录
					// console.log('用户已登录')
				},
				error: function(err) {
					// 用户未登录
					alert('请先登录!')
					window.location.href = 'login.html';
				}
			})
		</script>



	</body>
</html>
